/**
 * Create a JS File dediccated for Topup Module.
 * @author Geoff - 3/20/2015 - 10:47PM
 */
$(function () {
	$('input[name="filter_date_ref_from"]').datetimepicker({format: 'M/D/YYYY'});
	$('input[name="filter_date_ref_to"]').datetimepicker({format: 'M/D/YYYY'});

	$("#export_topup").click(function(){
		self.location = '{{ URL::to("top-up") }}/export?' + $("#form-filter").serialize();
	});
	
	$(".show-topup-reference").click(function(e){
		$("#general-modal .modal-dialog .modal-content").html('');
		e.preventDefault();
		$.ajax({
			url: $(this).attr('href'),
			type: 'GET',
			beforeSend: function(){
				$("#general-modal .modal-dialog .modal-content").html("<i>Loading...</i>");
			},
			success: function(response){
				$("#general-modal .modal-dialog .modal-content").html(response);
			}
		});
	});
	
	$('#general-modal').on('hidden.bs.modal', function () {
		$("#general-modal .modal-dialog .modal-content").html('');
	});
});